<template>
  <section class="page">
    <!-- 标题 -->
    <div class="title">
      <div>{{ propsForm.title}}</div>
      <div>订&nbsp;购&nbsp;单</div>
    </div>
    <!-- 表单字段 -->
    <div class="form">
      <div class="form-row">
        <div>厂&emsp;商：{{ propsForm.fullnmTC }}</div>
        <div>传真：{{ propsForm.vrFax }}</div>
        <div>采购单号：{{ propsForm.orderNo }}</div>
      </div>
      <div class="form-row">
        <div class="form-long-item">负责人：{{ propsForm.link }}</div>
        <div>采购日期：{{ (propsForm.ordDate || "").slice(0, 10) }}</div>
      </div>
      <div class="form-row">
        <div>电&emsp;话：{{ propsForm.vrTel }}</div>
        <div class="form-long-item">交货地点：{{ propsForm.place }}</div>
      </div>
    </div>
    <!-- 表格 -->
    <table style="width: 100%" border="1" cellspacing="0">
      <thead>
        <tr class="text-center bg-color">
          <th class="table-col">模具类别</th>
          <th>模具编号</th>
          <th>模具名称</th>
          <th class="table-col-short">单位</th>
          <th class="table-col-short">采购数量</th>
          <th class="table-col">单价</th>
          <th class="table-col">金额</th>
          <th class="table-col-short">币别</th>
          <th class="table-col">预排交期</th>
          <th class="table-col">说明</th>
        </tr>
      </thead>
      <tbody>
        <template v-for="(item, index) in propsForm.detailList">
          <tr :key="index">
            <td class="text-left">
              {{ item.moldType }}
            </td>
            <td class="text-left">
              {{ item.moldNo }}
            </td>
            <td class="text-left">
              {{ item.moldName }}
            </td>
            <td class="text-center">
              {{ item.unit }}
            </td>
            <td class="text-right">
              {{ item.ordQty }}
            </td>
            <td class="text-right">
              {{ $util.formatPrice(item.price) }}
            </td>
            <td class="text-right">
              {{ $util.formatPrice(item.price * item.ordQty, 2) }}
            </td>
            <td class="text-center">
              {{ item.curNo }}
            </td>
            <td class="text-center">
              {{ (item.planDate || "").slice(0, 10) }}
            </td>
            <td class="text-left">
              {{ item.note }}
            </td>
          </tr>
        </template>
      </tbody>
    </table>
    <!-- <div class="foot">
      <div class="foot-row">
        <div
          style="flex-basis: 40%; display: flex; justify-content: space-between"
        >
          <div>核准</div>
          <div>审计</div>
          <div>部门主管</div>
        </div>
        <div>
          <div>采购员</div>
          <div style="width: 14em"></div>
        </div>
      </div>
    </div> -->
    <div class="base-stamp">
      <table cellspacing="0" cellpadding="0" border="0" class="el-table__header table-flow">
        <thead class="has-gutter">
          <tr class="text-left">
            <th><div class="examine-cell">签核角色</div></th>
            <th><div class="examine-cell">审核人员</div></th>
            <th><div class="examine-cell">审核状况</div></th>
            <th><div class="examine-cell">审核意见</div></th>
            <th><div class="examine-cell">审核时间</div></th>
          </tr>
        </thead>
        <tbody>
          <template >
            <tr class="text-left" v-for="(item, index) in (propsForm.qhChkmgrdList || [])" :key="index">
              <td><div>{{item.flowDesc}}</div></td>
              <td><div>{{item.toUserCname}}</div></td>
              <td><div>{{item.chkStatusName}}</div></td>
              <td><div>{{item.chkOk}}</div></td>
              <td><div>{{item.chkDate}}</div></td>
            </tr>
          </template>
        </tbody>
      </table>
    </div>
  </section>
</template>

<script>
module.exports = {
  props: {
    propsForm: {
      type: Object,
      required: true,
    },
  },
  data() {
    return {
      parameterData: JSON.parse(sessionStorage.getItem('parameterData'))
    }
  },
};
</script>

<style scoped>
section {
  --border: 1px solid #000;
  --bg-color: #b3ffb3;
}

.page {
  margin: auto;
  font-size: 14px;
  max-width: 297mm;
  width: 100%;
}

.title {
  font-size: 20px;
  line-height: 1.4;
  text-align: center;
  margin-bottom: 0.5em;
  font-weight: bold;
}

.form {
  margin-bottom: 0.5em;
}
.form-row {
  display: flex;
  justify-content: space-between;
  line-height: 1.8;
  font-weight: 600;
}
.form-row div {
  flex-basis: 33.3%;
  text-align: left;
}
.form-long-item {
  flex-basis: 66.6% !important;
}

table {
  font-size: 14px;
}
table th,
td {
  padding: 4px;
}
.table-col {
  width: 6em;
}
.table-col-short {
  min-width: 3em;
}

.foot {
  margin-top: 3em;
}
.foot-row {
  display: flex;
  justify-content: space-between;
}
.foot-row > div > div {
  width: 1em;
}

/* commom */
.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-left {
  text-align: left;
}
.bg-color {
  background-color: var(--bg-color);
}
.base-stamp {
  margin-top: 3em;
}
</style>